﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
namespace BallData
{
    class DBUtil
    {
        public static void insert(String sql)
        {
            using (MySqlConnection conn = new MySqlConnection("server=ltfll.gicp.net;uid=qqxj;pwd=qqxj;database=match;Charset=gbk"))
            {
                try
                {
                    conn.Open();
                    MySqlCommand command = new MySqlCommand(sql, conn);

                    command.ExecuteNonQuery();
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    conn.Close();
                }
                

                
            }
        }
        public static void del(String sql)
        {

        }
        public static String getdata(String sql)
        {
            String result = String.Empty;
            using (MySqlConnection conn = new MySqlConnection("server=ltfll.gicp.net;uid=qqxj;pwd=qqxj;database=match;Charset=gbk"))
            {
                try
                {
                    conn.Open();
                    MySqlCommand command = new MySqlCommand(sql, conn);

                    MySqlDataReader read = command.ExecuteReader();

                    read.Read();
                    result = read.GetString("companyodds");


                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    conn.Close();
                }



            }
            return result;
        }
    }
}
